#include<iostream>
#include<cstdio>
using namespace std;
int n,m;
#define N 998244353
long long ans;
int gcd(int x,int y)
{
	return y==0?x:gcd(y,x%y);
}
int main()
{
	freopen("hoip.in","r",stdin);
	freopen("hoip.out","w",stdout);
	cin>>n>>m;
	for(int i=1;i<=n;i++)
	for(int j=1;j<=m;j++)
	{
		ans=(ans+gcd(i,j))%N;
	}
	cout<<ans;
} 

